export const state = {
  //用户数据
  userInfo: uni.getStorageSync('userInfo')||{},
  userDetail: uni.getStorageSync('userDetail')||{},
};
export const mutations = {
  //储存用户信息
  setUserInfo(state, data) {
  		state.userInfo =  Object.assign({},data);
  		// #ifdef H5
  		window.sessionStorage.setItem('userInfo', JSON.stringify(state.userInfo));
  		// #endif
  		// #ifndef H5
  		uni.setStorageSync('userInfo', state.userInfo);
  		// #endif
  },
  // 用户详情
  setUserDetail(state, data) {
		state.userDetail = Object.assign({},data);
  		// #ifdef H5
  		window.sessionStorage.setItem('userDetail', JSON.stringify(state.userDetail));
  		// #endif
  		// #ifndef H5
  		uni.setStorageSync('userDetail', state.userDetail);
  		// #endif
  },
  // 退出APP
  emptyUserInfo(state) {
  	state.userInfo = {};
  	// #ifdef H5
  	window.sessionStorage.removeItem("userInfo");
  	// #endif
  	// #ifndef H5
  	uni.removeStorageSync("userInfo");
  	// #endif
	
	// 用户详情
	state.userDetail = {};
	// #ifdef H5
	window.sessionStorage.removeItem("userDetail");
	// #endif
	// #ifndef H5
	uni.removeStorageSync("userDetail");
	// #endif
  },
};
export const actions = {
  
};
